sinclude .config.in

all: all_targets

CFLAGS = -ggdb3 -Wall
CFLAGS += -Iinclude/
CFLAGS += -Wno-pointer-sign
CFLAGS += -Wno-pointer-to-int-cast

obj_dir = .objs/

LDFLAGS =
LDFLAGS += -Wl,-rpath=./
LDFLAGS += -lutils2 -lhardware2 -lmedia -lpthread -lmedia_ffmpeg
LDFLAGS += -lm -Wl,--gc-sections
CFLAGS += -Wno-unused-variable
CFLAGS += -Wno-unused-but-set-variable

src-y +=$(wildcard utils/*.c)
src-y +=$(wildcard *.c)

module_name = output/endoscope
include tools/build_elf.mk

# ---------------------------
# the end
# ---------------------------

all_targets: $(module_targets)
	@echo "  compiled $(all_modules)"

app = $(filter-out %.so,$(all_modules))

ifneq ($(app),)
define install_app
	$(Q)cp -rf $(app) $(FS_TARGET_DIR)/usr/bin/

	@echo "  installed $(app)"
endef
define clean_install_app
	$(Q)rm -rf $(addprefix $(FS_TARGET_DIR)/usr/bin/, $(notdir $(app)))

	@echo "  removed $(app)"
endef
endif

install:
	$(install_app)

clean_install:
	$(clean_install_app)

clean:
	$(Q)rm -rf output/
	$(Q)rm -rf $(FS_TARGET_DIR)/usr/bin/$(app)

.PHONY: all clean all_targets clean_install install